// import Vue from 'vue'
// import Vuex from 'vuex'
import VuexPersistence from 'vuex-persist'
const vuexLocal = new VuexPersistence({
    storage: window.localStorage
})
// Vue.use(Vuex);


//创建一个store仓库
const store = new Vuex.Store({
//state用来存放数据的对象
state:{
//初始值、存放的东西
token:'',
wxUserInfo:'',
admin_id:'',
title:'生鲜商城',
base_url:'http://sx.jlxmall.com',
set_address:{}
},
//定义取数据;;;;用来操作修改state的
getters:{
// title:function(state){
//     return state.title;
// }
token:state=>state.wxUserInfo?state.wxUserInfo.tokeninfo.token:'',
wxUserInfo:state=>state.wxUserInfo,
base_url:state=>state.base_url,
admin_id:state=>state.admin_id,
set_address:state=>state.set_address
},
//存数据
mutations:{
    wxUserInfo(state,data){
        state.wxUserInfo = data
    },
    admin_id(state,data){
        state.admin_id = data
    },
    set_address(state,data){
        state.set_address = data;
    }
},
plugins: [vuexLocal.plugin]
})

export default store;